<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>业务管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			// $("#inputForm").validate({
			// 	submitHandler: function(form){
			// 		loading('正在提交，请稍等...');
			// 		form.submit();
			// 	},
			// 	errorContainer: "#messageBox",
			// 	errorPlacement: function(error, element) {
			// 		$("#messageBox").text("输入有误，请先更正。");
			// 		if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
			// 			error.appendTo(element.parent().parent());
			// 		} else {
			// 			error.insertAfter(element);
			// 		}
			// 	}
			// });
            $("#btnbao").click(function () {
                var id = "${firm.id}";
                var huiFirst = $("#huiFirst").val();
                var huiThird = $("#huiThird").val();
                var huiSecond = $("#huiSecond").val();
                var parm = {};
                parm["id"]=id;parm["huiFirst"]=huiFirst;parm["huiThird"]=huiThird;parm["huiSecond"]=huiSecond;
                $.ajax({
                    type : "POST",  //提交方式
                    url : "${ctx}/sys/firm/firm/saveHuiXin",//路径
                    data : parm,//数据，这里使用的是Json格式进行传输
                    success : function(data) {//返回数据根据结果进行相应的处理
                        if(data){
                            layer.msg("回访信息保存成功",{offset:'150px'},function(){
                                // setTimeout(function () {
                                //     window.location.reload();
                                // },1500)
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                                window.parent.location.reload();
                            });
                        }else{
                            layer.msg("回访信息保存失败",{offset:'150px'},function() {
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                                window.parent.location.reload();
                            });
                        }
                    }
                });
            })
            $("#btnbuttom").click(function () {
                var id = "${firm.id}";
                var difficulty = $("#difficulty").val();
                var sqLei = $("#sqLei").val();
                var qd = $("#qd").val();
                var tbXinxi = $("#tbXinxi").val();
                var sxTime = $(" input[ name='sxTime' ] ").val();
                var chuXinxi = $("#chuXinxi").val();
                var sbZd =$("#sbZd").val();
                var huiRemark = $("#huiRemark").val();
                var chuTime = $(" input[ name='chuTime' ] ").val();
                var huiFirst = $("#huiFirst").val();
                var parm = {};
                parm["id"]=id;parm["difficulty"] =difficulty;parm["qd"]=qd;parm["tbXinxi"]=tbXinxi;parm["sqLei"]=sqLei;parm["huiFirst"]=huiFirst;
                parm["sxTime"]=sxTime;parm["chuXinxi"]=chuXinxi;parm["sbZd"]=sbZd;parm["huiRemark"]=huiRemark;parm["chuTime"]=chuTime;
                if(difficulty == "" || difficulty == null || difficulty == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '案件难易程度不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(qd == "" || qd == null || qd == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '渠道不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(tbXinxi == "" || tbXinxi == null || tbXinxi == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '投保信息不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(sqLei == "" || sqLei == null || sqLei == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '申请类型不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(sxTime == "" || sxTime == null || sxTime == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '生效时间不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(chuXinxi == "" || chuXinxi == null || chuXinxi == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '出险信息不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(sbZd == "" || sbZd == null || sbZd == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '伤病诊断不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(chuTime == "" || chuTime == null || chuTime == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '出险时间不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                if(huiRemark == "" || huiRemark == null || huiRemark == undefined){
                    layer.open({
                        title: '提示信息'
                        ,content: '回访信息不能为空！！！',
                        time: 3000
                    });
                    return false;
                }
                else{
                    $.ajax({
                        type : "POST",  //提交方式
                        url : "${ctx}/sys/firm/firm/saveHuiFang",//路径
                        data : parm,//数据，这里使用的是Json格式进行传输
                        success : function(data) {//返回数据根据结果进行相应的处理
                            if(data){
                                layer.msg("回访信息保存成功！！",{offset:'150px'},function(){
                                    // setTimeout(function () {
                                    //     window.location.reload();
                                    // },1500)
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index); //再执行关闭
                                    window.parent.location.reload();
                                });
                            }else{
                                layer.msg("回访信息保存失败",{offset:'150px'},function() {
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index); //再执行关闭
                                    window.parent.location.reload();
                                });
                            }
                        }
                    });
                }
            })
            $("#btnclear").click(function () {
                $("#difficulty").val("");
                $("#qd").val("");
                $("#sqLei").val("");
                $("#tbXinxi").val("");
                $("#sxTime").val("");
                $("#chuTime").val("");
                $("#chuXinxi").val("");
                $("#sbZd").val("");
                $("#huiFirst").val("");
                $("#huiSecond").val("");
                $("#huiThird").val("");
                window.location.reload();
			})
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<%--<li><a href="${ctx}/sys/firm/firm/">业务列表</a></li>--%>
		<li class="active"><a href="${ctx}/sys/firm/firm/form?id=${firm.id}">业务<shiro:hasPermission name="sys:firm:firm:edit">${not empty firm.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:firm:firm:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="firm" action="${ctx}/sys/firm/firm/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="col-sm-2 control-label">难易程度：</label>
			<div class="controls">
				<form:select path="difficulty" class="input-large " name = "difficulty">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('jian_fu')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">* 简易案件是指不需调查的小金额医疗费用给付案件;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;复杂案件是指重疾、身故及其他需调查核实的案件;</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">渠道：</label>
			<div class="controls">
				<form:select path="qd" class="input-large " name="qd">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('qd_static')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group" >
			<label class="control-label">申请类型：</label>
			<div class="controls">
				<form:select path="sqLei" class="input-large " name = "difficulty">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('sq_lei')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">投保信息：</label>
			<div class="controls">
				<form:input path="tbXinxi" name="tbXinxi" htmlEscape="false" maxlength="255" class="input-xxlarge "/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">生效时间：</label>
			<div class="controls">
				<input name="sxTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					value="<fmt:formatDate value="${firm.sxTime}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出险时间：</label>
			<div class="controls">
				<input name="chuTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					   value="<fmt:formatDate value="${firm.chuTime}" pattern="yyyy-MM-dd"/>"
					   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出险信息：</label>
			<div class="controls">
				<form:textarea path="chuXinxi" name="chuXinxi" htmlEscape="false" rows="2" maxlength="255" class="input-xxlarge "/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">伤病诊断：</label>
			<div class="controls">
				<form:textarea path="sbZd" name="sbZd" htmlEscape="false" rows="2" maxlength="255" class="input-xxlarge "/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
        <div class="control-group">
            <label class="control-label">第一次回访：</label>
            <div class="controls">
                <form:textarea path="huiFirst" name="huiFirst" htmlEscape="false" rows="2" maxlength="255" class="input-xxlarge "/>
            </div>
        </div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="huiRemark" name="huiRemark" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>
			</div>
		</div>
		<div class="form-actions">
            <%--<shiro:hasPermission name="sys:firm:firm:edit"><input id="btnbao" class="btn btn-primary" type="button" value="保存回访"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</shiro:hasPermission>--%>
			<shiro:hasPermission name="sys:firm:firm:edit"><input id="btnbuttom" class="btn btn-primary" type="button" value="保 存"/>&nbsp;</shiro:hasPermission>
			<shiro:hasPermission name="sys:firm:firm:edit"><input id="btnclear" class="btn btn-primary" type="button" value="清 空"/>&nbsp;</shiro:hasPermission>
		</div>
	</form:form>
</body>
</html>